import axios from '@/utils/request'

export const getChannelList = () => {
  return axios({
    method: 'get',
    url: 'v1_0/user/channels'
  })
}

/**
 * 获取所有的频道信息
 */
export const getAllChannelList = () => {
  return axios({
    method: 'get',
    url: 'v1_0/channels'
  })
}

// 增加频道  部分覆盖
export const addChannels = channel => {
  return axios({
    method: 'patch',
    url: 'v1_0/user/channels',
    data: {
      channels: [channel]
    }
  })
}

export const delChannel = id => {
  return axios({
    method: 'delete',
    url: 'v1_0/user/channels' + id
  })
}

// 增加频道  重置式
export const setChannels = channels => {
  return axios({
    method: 'put',
    url: 'v1_0/user/channels',
    data: {
      channels: channels
    }
  })
}
